import http from "@/utils/request.js"
import {
	baseUrl
} from "@/core/config.js"

export function createAPI(prefix) {
	const createMethod = (method) => (url, data = {}, header = {}) => {
		return http.request({
			url: `${baseUrl}/${prefix}/${url}`,
			data,
			header,
			method
		});
	};

	return {
		post: createMethod('POST'),
		get: createMethod('GET')
	};
}